<?php

namespace app\validate;

use share\validate\SceneValidate;

class DeviceValidate extends SceneValidate
{
    protected $rule = [
        'pk' => 'require|min:6',
        'dn' => 'require|min:10',
        'sn' => 'require|alphaNum|min:10',
        'subPk'  => 'min:6',
        'iotId' => 'require|min:10',
        'isSub' => 'require|integer|min:0|max:1',
        'children' => 'array',
        'devices' => 'require|array',
        'code' => 'require|length:4,8',
        'account' => 'require|min:6',
        'accessToken' => 'alphaNum|max:128',
    ];

    protected $sceneRules = [];

    protected $scene = [
        'report' => ['pk', 'dn', 'sn', 'subPk', 'children'],
        'deviceList' => [
            'pk', 'dn', 'iotId','isSub'
        ],
        'sendTransferCode' => [
            'account','accessToken'
        ],
        'verifyTransferCode' => [
            'account','code'
        ],
        'transfer' => [
            'transferToken','account','devices'
        ],
    ];
}
